package com.xyh.flowershop.controller.websocket;

import com.xyh.flowershop.service.websocket.WebSocketServer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 小约翰可汗
 * @className WebSocketController
 * @createTime 2024/7/2118:02
 */
@RestController
@RequestMapping("/ws/")
public class WebSocketController {
    private final WebSocketServer webSocketServer;

    public WebSocketController(WebSocketServer webSocketServer) {
        this.webSocketServer = webSocketServer;
    }

    @GetMapping("getOnlineCount")
    public int getOnlineCount() {
        return webSocketServer.getInLineCount();
    }
}
